//
//  EventCenterAPIRequest.m
//  ConvenientlyTake
//
//  Created by 张奇 on 2022/12/22.
//

#import "EventCenterAPIRequest.h"
#define KPageSize 15

@implementation EventCenterAPIRequest

/// 事件中心-分页查询事件列表
/// @param eventState 事件状态(1-待受理; 2-指派中；3-处理中；4-待审核；5-局委审核中；6-宣传部审核中;7-已办结;8-不予受理)
/// @param promoter 发起人姓名或手机号
/// @param success success
/// @param fail fail
+ (NSURLSessionDataTask *)GETEventWithEventState:(NSInteger)eventState
                                           page:(NSInteger)page
                                       promoter:(NSString *)promoter
                                        success:(LZTResponseSuccess)success fail:(LZTResponseFailure)fail {
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    [parameters setValue:@(page) forKey:@"page"];
    [parameters setValue:@(KPageSize) forKey:@"pageSize"];
    if (eventState > 0) {
        [parameters setObject:@(eventState) forKey:@"eventState"];
    }
    if (promoter.length > 0) {
        [parameters setObject:promoter forKey:@"promoter"];
    }

    return [self GETWithURLString:@"api/m/event/findByPage" parameters:parameters success:success failure:fail];
}

/// 统计当前登录用户的待办任务数量
/// @param success success
/// @param fail fail
+ (NSURLSessionDataTask *)GETCountByCurrentUserWithSuccess:(LZTResponseSuccess)success fail:(LZTResponseFailure)fail {
    
    return [self GETWithURLString:@"api/public/todo-count/countByCurrentUser" parameters:nil success:success failure:fail];
}

@end
